package com.esri.android.map.popup;

import android.content.Context;
import android.view.MotionEvent;
import android.widget.LinearLayout;
import androidx.viewpager.widget.ViewPager;

/* loaded from: classes.dex */
public class PopupContainerView extends LinearLayout {
    a a;

    /* JADX INFO: Access modifiers changed from: package-private */
    public PopupContainerView(Context context, b bVar) {
        super(context);
        this.a = null;
        setBackgroundColor(-16777216);
        setOrientation(1);
        a aVar = new a(context, bVar);
        this.a = aVar;
        addView(aVar, new LinearLayout.LayoutParams(-1, -2, 1.0f));
    }

    public void enableSwipe() {
        this.a.a(true);
    }

    public void disableSwipe() {
        this.a.a(false);
    }

    public void setCurrentPopup(int i, boolean z) {
        this.a.setCurrentItem(i, z);
    }

    public int getCurrentPopupIndex() {
        return this.a.getCurrentItem();
    }

    public int getPopupCount() {
        return this.a.getAdapter().getCount();
    }

    public void setOnPageChangelistener(ViewPager.OnPageChangeListener onPageChangeListener) {
        this.a.setOnPageChangeListener(onPageChangeListener);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public static abstract class b implements ViewPager.OnPageChangeListener {
        ViewPager.OnPageChangeListener b;

        @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
        public void onPageSelected(int i) {
            ViewPager.OnPageChangeListener onPageChangeListener = this.b;
            if (onPageChangeListener != null) {
                onPageChangeListener.onPageSelected(i);
            }
        }

        @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
        public void onPageScrolled(int i, float f, int i2) {
            ViewPager.OnPageChangeListener onPageChangeListener = this.b;
            if (onPageChangeListener != null) {
                onPageChangeListener.onPageScrolled(i, f, i2);
            }
        }

        @Override // androidx.viewpager.widget.ViewPager.OnPageChangeListener
        public void onPageScrollStateChanged(int i) {
            ViewPager.OnPageChangeListener onPageChangeListener = this.b;
            if (onPageChangeListener != null) {
                onPageChangeListener.onPageScrollStateChanged(i);
            }
        }

        void a(ViewPager.OnPageChangeListener onPageChangeListener) {
            this.b = onPageChangeListener;
        }
    }

    /* loaded from: classes.dex */
    class a extends ViewPager {
        private boolean b;
        private b c;

        public a(Context context, b bVar) {
            super(context);
            this.b = true;
            this.c = bVar;
            super.setOnPageChangeListener(bVar);
        }

        @Override // androidx.viewpager.widget.ViewPager, android.view.View
        public boolean onTouchEvent(MotionEvent motionEvent) {
            if (this.b) {
                return super.onTouchEvent(motionEvent);
            }
            return false;
        }

        @Override // androidx.viewpager.widget.ViewPager, android.view.ViewGroup
        public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
            if (this.b) {
                return super.onInterceptTouchEvent(motionEvent);
            }
            return false;
        }

        public void a(boolean z) {
            this.b = z;
        }

        @Override // androidx.viewpager.widget.ViewPager
        public void setOnPageChangeListener(ViewPager.OnPageChangeListener onPageChangeListener) {
            this.c.a(onPageChangeListener);
        }
    }
}
